package xcmg.device.dao.mapper.warehouse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.warehouse.WarehouseDO;
import xcmg.device.service.vo.warehouse.WarehouseSearch;

import java.util.List;

@Mapper
public interface WarehouseDOMapper {
    int deleteByPrimaryKey(@Param("warehouseId") String warehouseId);

    int insert(WarehouseDO record);

    int countByWarehouseCode(@Param("orgId") String orgId, @Param("warehouseCode") String warehouseCode);

    @Deprecated
    List<WarehouseDO> list(@Param("warehouseCode") String warehouseCode, @Param("description") String description,
                           @Param("orgId") String orgId,@Param("keyWords") String keyWords,
                           @Param("warehouseCodeList") List<String> warehouseCodeList,@Param("purchaseOrgName") String purchaseOrgName,
                           @Param("warehouseType") String warehouseType, @Param("stopUsing") Integer stopUsing);

    List<WarehouseDO> queryList(WarehouseSearch param);

    List<WarehouseDO> listNoBarcode(@Param("orgId") String orgId, @Param("warehouseCode") String warehouseCode, @Param("description") String description);

    WarehouseDO itemByWarehouseCode(@Param("orgId") String orgId, @Param("warehouseCode") String warehouseCode);

    int countIsBarCode(@Param("orgId") String orgId, @Param("warehouseCode") String warehouseCode);

    int updateByPrimaryKeySelective(WarehouseDO warehouseDO);

    Integer countByDesc(@Param("orgId") String orgId, @Param("description") String description);

    Integer countNotSelfByDesc(@Param("orgId") String orgId, @Param("description") String description,@Param("selfId") String selfId);

    List<WarehouseDO> itemByDescription(@Param("orgId") String orgId, @Param("description") String description);

    List<WarehouseDO> selectWarehousesByWarehouseType(@Param("orgId") String orgId,@Param("warehouseType") String warehouseType,@Param("warehouseCodes") List<String> warehouseCodes);
    // 带权限限制的查询
    List<WarehouseDO> listPermit(@Param("warehouseCode") String warehouseCode, @Param("description") String description,
                           @Param("orgId") String orgId, @Param("permissionWarehouses") List<String> permissionWarehouses,
                           @Param("stopUsing") Integer stopUsing);

    int updateStopUsing(@Param("id") String id,@Param("stopUsing") Integer stopUsing);

    int countByFactoryId(@Param("orgId") String orgId,@Param("factoryId") String factoryId,@Param("warehouseId") String warehouseId);
}
